using System;
using System.Web;
using System.Web.UI;

namespace lib
{
	public class BasePage : System.Web.UI.Page
		
	 {	
		 private string pageTitle;
		 private string message;
		 private string messageVb;
         private string resultStr;
		 private string helpDocName;
		

		 public string PageTitle 
		 {
			 get { return pageTitle; }
			 set { pageTitle = value; }
		 }

		public string Message
		{
			get { return message; }
			set { message = value; }
		}

		public string MessageVb
		{
			get { return messageVb; }
			set { messageVb = value; }
		}

		public string ResultStr
		{			
			get { return resultStr; }
			set { resultStr = value; }
		}

		public string HelpDocName
		{			
			get { return helpDocName; }
			set { helpDocName = value; }
		}

		 protected override void OnInit(System.EventArgs e) 
		 {
			 //if (Session["user"]=="") {FormsAuthentication.RedirectFromLoginPage(MyLogin.UserId, false);}

			 if (Session["user"]==null)
			 {
				 Response.Write("<script>parent.location.href='/ccapps/login.aspx'</script>") ;	
				 Response.End();
			 }
			 else if ((string)(Session["user"]) == "") 
			 { 							     
			     Response.Write("<script>parent.location.href='/ccapps/login.aspx'</script>") ;				 
				 Response.End();
				 
			 }
			 else
			 {
				 this.Controls.AddAt(0, LoadControl("/ccapps/web/layout/Header.ascx"));
				 				 
				 string screen= Page.ToString().Substring(4);
				 //ccapps.persistent.authorization.Set_Logout(ccapps.GlobalVar.userID, Session.SessionID);
				 string strSQL;
				 if (screen != "logout_aspx") 
				 {
					 strSQL = " update login_log set last_screen='" + screen + "' , last_change=sysdate where userid='" + Session["user"]   + "' and sessionid='" + Session.SessionID  + "' and logout_date is null ";
					 myDBconn2.ORAExecute2(strSQL);
				 }
			
				 base.OnInit(e);			 
				 this.Controls.Add(LoadControl("/ccapps/web/layout/Footer.ascx"));				 
				 
			 }
		 }
	 }

	public class BaseControl : System.Web.UI.UserControl
	{
		public new BasePage Page 
		{
			get { return (BasePage)base.Page; }
		}
	}
}
